package com.example.administrator.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.administrator.myapplication.util.DB;

public class SignInActivity extends AppCompatActivity {

    private EditText signInUsernameEt;
    private EditText studentIdEt;
    private Button signInBtn;
    private String usernameStr;
    private String studentidStr;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_in);
        initView();

        initEvent();
    }

    private void initView() {
        signInUsernameEt = findViewById(R.id.sign_in_username_et);
        studentIdEt = findViewById(R.id.student_id_et);
        signInBtn = findViewById(R.id.sign_in_btn);
    }

    private void initData() {
        usernameStr = signInUsernameEt.getText().toString() + "";
        studentidStr = signInUsernameEt.getText().toString() + "";

    }

    private void initEvent() {
        signInBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                initData();
                DB db = new DB(SignInActivity.this);
                Boolean result=   db.loginSelect(usernameStr, studentidStr);
                Toast.makeText(SignInActivity.this, "注册成功", Toast.LENGTH_SHORT).show();
            }
        });
    }
}
